package com.company.cloud.acct.modules.api.fallback;

import com.company.cloud.acct.modules.api.request.AcctGetRequest;
import com.company.cloud.acct.modules.api.request.AcctOpRequest;
import com.company.cloud.acct.modules.api.response.AccountModel;
import com.company.cloud.acct.modules.api.service.AccountRemoteService;
import com.company.cloud.common.bean.BaseClientResult;
import feign.hystrix.FallbackFactory;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Component;

@Log4j2
@Component
public class AccountRemoteServiceFallbackFactory implements FallbackFactory<AccountRemoteService> {
    @Override
    public AccountRemoteService create(Throwable cause) {
        return new AccountRemoteService() {
            @Override
            public BaseClientResult<String> opAcct(AcctOpRequest request) {

                return BaseClientResult.callbackError();
            }

            @Override
            public BaseClientResult<AccountModel> getAcct(AcctGetRequest request) {
                return BaseClientResult.callbackError();
            }
        };
    }
}
